package com.haolp.sys.controller;

import com.haolp.sys.common.vo.JsonResultVO;
import com.haolp.sys.pojo.SysDept;
import com.haolp.sys.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小李
 * @version 1.0
 * @date 2021/10/13 17:47
 */
@RestController
@RequestMapping("/dept/")
public class SysDeptController {
    @Autowired
    SysDeptService sysDeptService;

    @RequestMapping("doUpdateObject")
    public JsonResultVO doUpdateObject(SysDept entity) {
        sysDeptService.updateObject(entity);
        return new JsonResultVO("update ok");
    }

    @RequestMapping("doFindZTreeNodes")
    public JsonResultVO doFindZTreeNodes() {
        return new JsonResultVO(sysDeptService.doFindZTreeNodes());
    }

    @RequestMapping("doSaveObject")
    public JsonResultVO doSaveObject(SysDept entity) {
        sysDeptService.saveObject(entity);
        return new JsonResultVO("insert ok");
    }

    @RequestMapping("doFindZtreeDeptNodes")
    public JsonResultVO doFindZtreeDeptNodes() {
        return new JsonResultVO(sysDeptService.findZtreeDeptNodes());
    }

    @RequestMapping("doDeleteObject")
    public JsonResultVO doDeleteObject(Integer id) {
        sysDeptService.deleteObject(id);
        return new JsonResultVO("delete ok");
    }

    @RequestMapping("doFindObjects")
    public JsonResultVO doFindObjects() {
        return new JsonResultVO(sysDeptService.findObjects());
    }

    @RequestMapping("doLoadZTreeNodes")
    public JsonResultVO doLoadZTreeNodes() {
        return new JsonResultVO(sysDeptService.findZTreeNodes());
    }
}
